
<?
	   layout("/inc/win_layout.html",{title:sysTitle}){
    ?>

<div class="row" style="min-height: auto;padding-bottom: 20px;">
	<div class="col-lg-12">
		<div class="panel">
			<div class="panel-body pan" style="height: 450px">
				<form action="#" class="form-horizontal">
					<div class="form-body pal" style="width:auto; height: auto; margin-bottom: 0px;">
						
						
						<div style="width:350px;  margin:0 30px 0 60px; padding-bottom: 10px;">
							<label for="inputUsername" class="col-md-3 control-label">数据源名称
								<span class='require' id="zhongwenName">*</span> </label>
							<div class="col-md-9">
								<div class="input-icon">
									<input id="name" type="text" class="form-control"  />
								</div>
							</div>
						</div>
						
						<div style="width:350px;  margin:0 30px 0 60px; padding-bottom: 10px;">
							<label for="inputUsername" class="col-md-3 control-label">数据源描述
								<span class='require' id="zhongwenName">*</span> </label>
							<div class="col-md-9">
								<div class="input-icon">
									<input id="description" type="text" class="form-control"  />
								</div>
							</div>
						</div>

						<div style="width:350px;  margin:0 30px 0 60px;padding-bottom: 10px;">
							<label for="inputUsername" class="col-md-3 control-label">数据源类型
								<span class='require' id="leixing">*</span> </label>
							<div class="col-md-9">
								<div class="input-icon">
									<select id="sourceType" class="form-control">
										<option value="excel">excel</option>
									</select>
								</div>
							</div>
						</div>
						
						<div style="width:350px;  margin:0 30px 0 60px; padding-bottom: 10px;">
							<label for="inputUsername" class="col-md-3 control-label">用户名
								<span class='require' id="leixing"></span> </label>
							<div class="col-md-9">
								<div class="input-icon">
									<input id="user" type="text" class="form-control"  />
								</div>
							</div>
						</div>
						
						<div style="width:350px;  margin:0 30px 0 60px; padding-bottom: 10px;">
							<label for="inputUsername" class="col-md-3 control-label">密码
								<span class='require' id="leixing"></span> </label>
							<div class="col-md-9">
								<div class="input-icon">
									<input id="password" type="text" class="form-control"  />
								</div>
							</div>
						</div>
						
						<div style="width:350px;  margin:0 30px 0 60px; padding-bottom: 10px;">
							<label for="inputUsername" class="col-md-3 control-label">状态
								<span class='require' id="paixu">*</span> </label>
							<div class="col-md-9">
								<div class="input-icon">
									<select id="status" class="form-control">
										<option value="1">可使用</option>
										<option value="2">禁用</option>
									</select>
								</div>
							</div>
						</div>
						<input id="id" type="hidden" class="form-control" />
						
					</div>	
				</form>
			</div>
		</div>
	</div>
</div>
<?} ?>
<script>
	var index1 = window.parent.getlay();
	$("#id").val(index1);
	$(function() {
		if (index1 != 0) {
			demo1();
		}
	});
	function Page() {
				if($.trim($("#name").val()).length<1) {
    	        	alert('文件名称不能为空！');
    	        	return null;
    	        }
    	        if($.trim($("#description").val()).length<1) {
    	        	alert('数据源名称不能为空！');
    	        	return null;
    	        }
    	       
		$.ajax({
			type : "post",
			url : "./addEditDataSource.do",
			data : {
				"id" : index1,
				"name" : $("#name").val(),
				"description" : $("#description").val(),
				"sourceType" : $("#sourceType").val(),
				"user" : $("#user").val(),
				"password" : $("#password").val(),
				"status": $("#status").val(),
			},
			dataType : "json",
			async : false,
			success : function(data) {
				var index = parent.layer.getFrameIndex(window.name);
				window.parent.get();
				parent.layer.msg('提交成功');
				parent.layer.close(index);
			},
			error : function(data) {
				alert("请求失败");
			}
		});
	}

	function demo1() {
		$.getJSON('./dataSourceEditShow.do', {
			id : index1
		//向服务端传的参数，此处只是演示
		}, function(res) {
			//此处仅仅是为了演示变化的内容
			$("#id").val(res[0].id);
			$("#name").val(res[0].name);
			$("#description").val(res[0].description);
			$("#sourceType").val(res[0].sourceType);
			$("#user").val(res[0].user);
			$("#password").val(res[0].password);
			$("#status").val(res[0].status);
		});
	};

</script>


